<template>
  <el-card class="box-card">
  	<div slot="header" class="clearfix">
  	<span>共享信息 </span>
  	<el-button style="float: right; padding: 3px 0" type="text" ></el-button>
  	</div>
  <div class="app-container">
    <el-table v-loading="loading" :data="ordershareList">
      <el-table-column label="科室/部门" align="center" prop="sysDept.deptName" />
      <el-table-column label="设备类别" align="center" prop="devicetype"/>
      <el-table-column label="设备型号" align="center" prop="zyxDevice.devicemodel" />
      <el-table-column label="设备状态" align="center" prop="servicestatus"  :formatter="servicestatusFormat"/>

    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
   </el-card>
</template>

<script>
import { listMyOrdershare, getOrdershare, delOrdershare, addOrdershare, updateOrdershare, exportOrdershare } from "@/api/zyx/ordershare";

export default {
  name: "Ordershare",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 共享表格数据
      ordershareList: [],
      // 服务状态字典
      servicestatusOptions: [],
      // 设备类别字典字典
      devicetypeOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 6,
        sendorderid: null,
        userid: null,
        orderByColumn:'id',
        isAsc:'asc',
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("zyx_servicestatus").then(response => {
      this.servicestatusOptions = response.data;
    });
    this.getDicts("zyx_devicetype").then(response => {
      this.devicetypeOptions = response.data;
    });
  },
  methods: {
    // 服务状态字典翻译
    servicestatusFormat(row, column) {
      return this.selectDictLabel(this.servicestatusOptions, row.servicestatus);
    },
    // 设备类别字典字典翻译
    devicetypeFormat(row, column) {
      return this.selectDictLabel(this.devicetypeOptions, row.devicetype);
    },
    /** 查询共享列表 */
    getList() {
      this.loading = true;
      listMyOrdershare(this.queryParams).then(response => {
        this.ordershareList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sendorderid: null,
        userid: null,
        remark: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },


  }
};
</script>
